﻿//Eggtimer by Thomas Arvidsson, 2011-12-27

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace EggTimer.StaticUtilityMethods
{
    public static class StaticMethods
    {
        public static double ConvertMetersFromFeet(double feet)
        {
            return feet * 0.3048;
        }

        public static double ConvertFeetFromMeters(double meters)
        {
            return meters * 3.28084;
        }

        public static double GetBoilingWaterTemperatureCelcius(double altitudeFeet)
        {            
            double temp = 0.0;

            double pressureHg = 29.921 * (Math.Pow((1 - 6.8753 * 0.000001 * altitudeFeet), 5.2559));

            temp = 49.161 * Math.Log(pressureHg) + 44.932;
            //[°C] = ([°F] - 32) × 5/9 

            temp = Math.Round(((temp - 32) * 5 / 9), 2);

            return temp;
        }

        ///// <summary>
        ///// Calculates the cooking time of the egg
        ///// </summary>
        ///// <returns></returns>
        //public static double GetTimerSeconds(double eggSizeToCount, double boilingWaterTemp, double eggTempBeforeCooking, double eggTempDone)
        //{
        //    double seconds = Math.Pow(eggSizeToCount, 2) * Math.Log(2 * ((boilingWaterTemp - eggTempBeforeCooking) / (boilingWaterTemp - eggTempDone)));
        //    return seconds;
        //}


        //public static string GetTimerValue(decimal totalSeconds)
        //{
        //    string timerValue = "";
        //    decimal minutes = (decimal)totalSeconds / 60;
        //    minutes = decimal.Truncate(minutes);

        //    decimal seconds = totalSeconds % 60;
        //    if (seconds < 10 && seconds >= 0)
        //    {
        //        timerValue = minutes.ToString() + ":" + "0" + seconds.ToString();
        //    }
        //    else
        //    {
        //        timerValue = minutes.ToString() + ":" + seconds.ToString();
        //    }

        //    return timerValue;
        //}

    }
}
